#!/usr/bin/env python3
# coding=utf-8
'''
说明：设置Windows的音量
'''
# import ctypes
# import struct
#
# waveOutGetVolume = (ctypes.windll.winmm.waveOutGetVolume)
# waveOutSetVolume = (ctypes.windll.winmm.waveOutSetVolume)
#
# MINIMUM_VOLUME = 0
# MAXIMUM_VOLUME = 100
#
# def SetVolume(volume):
#     if not (MINIMUM_VOLUME <= volume <= MAXIMUM_VOLUME):
#         print(ValueError, "Volume out of range")
#     volume = volume * MAXIMUM_VOLUME/100
#     ret = waveOutSetVolume(volume)
#     if ret != 0:
#         print(WindowsError, "Error %d while setting volume" % ret)
#     return

import win32api

WM_APPCOMMAND = 0x319

APPCOMMAND_VOLUME_MAX = 0x0a
APPCOMMAND_VOLUME_MIN = 0x09

#音量最大
#win32api.SendMessage(-1, WM_APPCOMMAND, 0x30292, APPCOMMAND_VOLUME_MAX * 0x10000)

#音量最小
win32api.SendMessage(-1, WM_APPCOMMAND, 0x30292, APPCOMMAND_VOLUME_MIN * 0x10000)

exit()